package com.xbchzh.clifford.listener;


import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import com.xbchzh.clifford.utils.WxConfigBean;


public class ApplicationListener implements ServletContextListener{
	private ServletContext application = null;
	private ApplicationContext appcontext = null;
	@Override
	public void contextDestroyed(ServletContextEvent sc) {
		
	}

	@Override
	public void contextInitialized(ServletContextEvent sc) {
		if(application==null){
			application = sc.getServletContext();
		}
		if(appcontext==null){
			appcontext = WebApplicationContextUtils.getWebApplicationContext(application);
		}
		
		//初始化获得微信验证信息
		WxConfigBean _WxConfigBean = WxConfigBean.getWxConfigBean();	
		_WxConfigBean.updata("NULL");
		application.setAttribute("WxConfigBean", _WxConfigBean);
		
		
		
	}
	

}
